#include<stdio.h>
#include<unistd.h>
#include"proc.h"

#define SIZE 102    //进度条长度100 + 结尾\0 + 箭头1 = 102
#define STYLE '='
#define ARR '>'

void process()
{
    char bar[SIZE];
    const char* lab = "|/-\\";
    memset(bar, '\0', sizeof(bar));//全部初始化为空字符
    int i = 0;
    while(i <= 100)
    {
        printf("[%-100s][%d%%][%c]\r", bar, i, lab[i%4]);
        fflush(stdout);//刷新缓冲区，打印一下	
        bar[i++] = STYLE;
	if(i != 100)
        {
            bar[i] = ARR;
	}
	usleep(100000);//等待1s刷新一次
    }
    printf("\n");
}
